<template class='body'>
  <section class="div1">
    <div class="l-login">
      <!-- <img src="../asset/images/gound1.jpg" /> -->
    </div>
    <div class="frpm-div1">
      <!-- from-->
      <el-form
        :model="ruleForm2"
        :rules="rules2"
        ref="ruleForm2"
        label-position="left"
        label-width="0px"
        class="demo-ruleForm login-container"
      > 
      <div class="top">
        <img src="../asset/images/tcczj.png" alt="陕西省铜川市财政局" srcset="" />
        <div class="companyname">
        <span class="companyname1">铜川市王益区财政局</span>
        </div>
      </div>
      <div style="text-align: center; margin-bottom: 20px">
        <span class="name">山水林田湖草生态修复集成跟踪系统</span>
      </div>
        <span>用户名</span>
        <el-form-item prop="userName">
          <el-input
            type="text"
            v-model="ruleForm2.userName"
            auto-complete="off"
          ></el-input>
        </el-form-item>
        <span>密码</span>
        <el-form-item prop="password">
          <el-input
            type="password"
            v-model="ruleForm2.password"
            auto-complete="off"
          ></el-input>
        </el-form-item>

        <el-checkbox
          v-model="checked"
          checked
          class="remember"
          style="color: #2987bb; font-size: 15px"
          >记住密码</el-checkbox
        >

        <el-button
          type="primary"
          class="sublogin"
          @click.native.prevent="handleSubmit"
          :loading="logining"
          >登录</el-button
        >
      </el-form>
    </div>

    <div class="foot">&copy;2018&nbsp;铜川市王益区财政局&nbsp;版权所有</div>
  </section>
</template>

<script>
//import NProgress from 'nprogress'
export default {
  data() {
    return {
      logining: false,
      ruleForm2: {
        userName: "",
        password: "",
      },
      rules2: {
        userName: [
          { required: true, message: "请输入账号", trigger: "blur" },
          //{ validator: validaePass }
        ],
        password: [
          { required: true, message: "请输入密码", trigger: "blur" },
          //{ validator: validaePass2 }
        ],
      },
      checked: true,
    };
  },
  methods: {
    handleReset() {
      this.$refs.ruleForm2.resetFields();
    },

    handleSubmit(ev) {
      var _this = this;

      this.$refs.ruleForm2.validate((valid) => {
        if (valid) {
          this.logining = true;
          var data = {
            userName: this.ruleForm2.userName,
            password: this.ruleForm2.password,
          };
          this.loginModel
            .login(data)
            .then((res) => {
              console.log(res);
              if (res.status == 200) {
                sessionStorage.setItem("token", res.data.token);
                window.location.href = "/";
              } else {
                this.logining = false;
                _this.$message({
                  message: res.msg,
                  type: "warning",
                });
              }
            })
            .catch((err) => {
              console.log("cc" + err.message);
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.div1 {
  height: 100%;
  background-color: #f8fafc;
}
span {
  font-size: 18px;
  color: #394877;
}
.top {
  display: flex;
  height: 10%;
  margin-left: -20px;
  margin-bottom: 30px;
}
.top img {
  float: right;
  margin-right: 5px;
  width: 5rem;
  height: 5rem;
}
.top .companyname {
  padding-top: 1.25rem;
  width: 28.125rem;
  text-align: center;
}

.top .companyname .companyname1 {
  font-weight: 800;
  font-size: 1.4rem;
  color: #000;
}
.top .companyname .companyname2 {
  font-weight: 800;
  font-size: 0.9375rem;
  color: #000;
}
.l-login {
  //position: absolute;
  /* right: 55%;
  top: 14%;
  bottom: 10%; */
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  background-image:linear-gradient(to top, rgba(255,255,255,0), rgba(255,255,255,1)), 
  url(../asset/images/gound1.jpg);
  background-repeat: no-repeat;
  background-size: 100%,100%;
}

.l-login img {
  width: 100%;
}

@media screen and (max-width: 1444px) {
  .l-login img {
    width: 70%;
  }
  .l-login {
    right: 40%;
  }
}

@media screen and (min-width: 1900px) {
  .top img {
    float: left;
    width: 75px;
    height: 75px;
    margin-top: 5px;
  }
  .top .companyname {
    padding-top: 18px;
    width: 730px;
    text-align: center;
  }
  .top .companyname .companyname1 {
    font-weight: 800;
    font-size: 30px;
    color: #000;
  }
  //  .top .companyname .companyname2{
  //      font-weight: 800;
  //      font-size: 25px;
  //      color: #000;
  // }
}
.frpm-div1 {
  position: absolute;
  width: 22%;
  left: 65%;
  top: 35%;
  margin-top: -182px;
  margin-left: -11%;
}
.name {
  font-size: 30px;
  font-weight: bold;
  color: #221f1fc5;
}
.sublogin {
  float: right;
  background-color: #ffffff;
  color: #2987bb;
  margin-right: 0.625rem;
}
.login-container {
  -webkit-border-radius: 0.4375rem;
  opacity: 0.7;
  border-radius: 0.4375rem;
  -moz-border-radius: 0.4375rem;
  background-clip: padding-box;
  width: 360px;
  padding: 10% 10% 10% 12%;
  background: #ffffff;
  //height: 20%;
  margin-top: 35px;
  .title {
    margin: 0rem auto 2.5rem auto;
    text-align: center;
    color: #505458;
  }
  .rremrember {
    margin: 0rem 0rem 2.1875rem 0rem;
  }
}
.foot {
  position: absolute;
  bottom: 1rem;
  width: 100%;
  font-size: 120%;
  color: #ffffffc5;
  text-align: center;
}
</style>
<style>
section {
  width: 100%;
  height: 100%;
}
.remember {
  margin-top: 2%;
}
</style>
